package server.gui;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JTextArea;

import javax.swing.JScrollPane;
import javax.swing.WindowConstants;

import server.domein.ChatController;
import server.domein.ChatListener;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ServerFrame extends javax.swing.JFrame{
	private static final long serialVersionUID = 1L;
	private JTextArea txtText;
	private ChatController chat;
	private JScrollPane txtInfo;
	public ServerFrame()
	{
		super();
		chat = new ChatController();
		chat.addChatListener(new ChatListener(){
		public void dataReceived(String data)
		{
			txtText.append(data);
		}
		});
		
		initGUI();
		
		this.addWindowListener(new WindowAdapter()
		{
		    public void windowClosing(WindowEvent w)
		    {
		    	System.exit(0);
		    }
		});
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setVisible(true);
			getContentPane().setLayout(null);
			{
				txtText = new JTextArea();
				txtText.setBounds(5, 7, 375, 253);
				txtText.setVisible(true);
				txtInfo = new JScrollPane(txtText);
				txtInfo.setBounds(5, 7, 375, 253);
				txtInfo.setVisible(true);
				getContentPane().add(txtInfo);
			}
			pack();
			setSize(400, 300);
			this.setResizable(false);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
